#include <algorithm>
#include <vector>
#include <cmath>
#include <iostream>
#include <cstdio>
#include <set>
#include <map>
#include <cstdlib>
#define LL long long
#define ldb long double
const ldb eps = 1e-9;
const ldb pi = fabsl(atan2(0.0, -1.0));
const int INF = 0x7f7f7f7f;
const LL LINF = 1ll << 60;
const ldb LDINF = 1e42;
#define nextLine() {int c = 0; while ((c = getchar()) != 10 && c != EOF);}
#define addEdge(a, b) next[edges] = first[a]; first[a] = edges; end[edges] = b; edges++;
using namespace std;

int n, k;
string s;
int a[110];
int res[110];
int p[110];

void Load()
{
	cin >> n >> k;
	cin >> s;
	p[1] = 0;
	int i, k = 0;
	for (i = 2; i <= s.size(); i++)
	{
		while (k > 0 && s[k] != s[i - 1]) k = p[k];
		if (s[k] == s[i - 1]) k++;
		p[i] = k;  
	}
	nextLine();
	for (int i = 0; i < n - s.size() + 1; i++)
	{
		a[i] = getchar() - '0';
	}
}

void Solve()
{
	int k = 0, i, j, t;
	for (i = 0; i < n; i++)
	{
		if (a[i] == 1)
		{
			if (res[i] != 0)
			{
				for (j = 0; j < s.size(); j++)
				{
					if (res[i + j] != 0 && res[i + j] != s[j])
					{
						cout << "No solution";
						return;
					}
					else
					{
						res[i + j] = s[j];
					}
				}
			}
			else 
			{
				for (j = 0; j < s.size(); j++)
				{
					res[i + j] = s[j];
				}
			}
		}
		if (res[i] == 0)
		{
			int rr = 110, rch;
			for (j = 'a'; j <= 'a' + ::k - 1; j++)
			{
				t = k;
				while (t > 0 && s[t] != j) t = p[t];
				if (s[t] == j) t++;

				if (rr > t) 
				{
					rr = t, rch = j;
				}
			}
			cerr << rr << " " << (char)rch;
			res[i] = rch;
			k = rr;
			if (k == s.size() && a[i - s.size() + 1] == 0)
			{
				cout << "No solution";
				return;
			}

		}
		else
		{
			t = k;
			while (t > 0 && s[t] != res[i]) t = p[t];
			if (s[t] == res[i]) t++;
			if (t == s.size() && a[i - s.size() + 1] == 0)
			{
				cout << "No solution";
				return;
			}
			k = t;
		}

	}	
	for (i = 0; i < n; i++)
	{
		putchar(res[i]);
	}
}

int main()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "rt", stdin);
	freopen("output.txt", "wt", stdout);
	#endif
	Load();
	Solve();
	return 0;
}